.\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
.\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
.\"
.\" SPDX-License-Identifier: GPL-3.0-or-later
.\"
.TH proc_pid_map_files 5 2024-05-02 "Linux man-pages 6.9.1"
.SH NAME
/proc/pid/map_files/ \- memory-mapped files
.SH DESCRIPTION
.TP
.IR /proc/ pid /map_files/ " (since Linux 3.3)"
.\" commit 640708a2cff7f81e246243b0073c66e6ece7e53e
This subdirectory contains entries corresponding to memory-mapped
files (see
.BR mmap (2)).
Entries are named by memory region start and end
address pair (expressed as hexadecimal numbers),
and are symbolic links to the mapped files themselves.
Here is an example,
with the output wrapped and reformatted to fit on an 80-column display:
.IP
.in +4n
.EX
.RB "#" " ls \-l /proc/self/map_files/"
lr\-\-\-\-\-\-\-\-. 1 root root 64 Apr 16 21:31
            3252e00000\-3252e20000 \-> /usr/lib64/ld\-2.15.so
\&...
.EE
.in
.IP
Although these entries are present for memory regions that were
mapped with the
.B MAP_FILE
flag, the way anonymous shared memory (regions created with the
.B MAP_ANON | MAP_SHARED
flags)
is implemented in Linux
means that such regions also appear on this directory.
Here is an example where the target file is the deleted
.I /dev/zero
one:
.IP
.in +4n
.EX
lrw\-\-\-\-\-\-\-. 1 root root 64 Apr 16 21:33
            7fc075d2f000\-7fc075e6f000 \-> /dev/zero (deleted)
.EE
.in
.IP
Permission to access this file is governed by a ptrace access mode
.B PTRACE_MODE_READ_FSCREDS
check; see
.BR ptrace (2).
.IP
Until Linux 4.3,
.\" commit bdb4d100afe9818aebd1d98ced575c5ef143456c
this directory appeared only if the
.B CONFIG_CHECKPOINT_RESTORE
kernel configuration option was enabled.
.IP
Capabilities are required to read the contents of the symbolic links in
this directory: before Linux 5.9, the reading process requires
.B CAP_SYS_ADMIN
in the initial user namespace;
since Linux 5.9, the reading process must have either
.B CAP_SYS_ADMIN
or
.B CAP_CHECKPOINT_RESTORE
in the initial (i.e. root) user namespace.
.SH SEE ALSO
.BR proc (5)
